﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;
using Provider;

namespace AccessToDataEnergyLibrury
{
    public partial class AccessDataEnergyLibrury
    {
        energyzmemDataSet energyDataSet;
        Provider.Provider provider = new Provider.Provider();

/// <summary>
/// 
/// </summary>
/// <param name="dataType"></param>
/// <param name="targetData"></param>
        public AccessDataEnergyLibrury(SourceType dataType, string targetData)
        {
            this.energyDataSet = this.provider.GetAllData(dataType, targetData);
        }

/// <summary>
        /// 
        /// </summary>
        /// <param name="searchedTable"></param>
        /// <returns></returns>
        private string MakeFilteredQwery(Dictionary<string, string> searchedTable)
        {
            string filter = string.Empty;

            if (searchedTable == null)
                return filter;

            foreach (KeyValuePair<string, string> kvp in searchedTable)
            {
                if (kvp.Value == null || kvp.Value == string.Empty)
                    continue;

                if (String.IsNullOrEmpty(filter))
                    filter += string.Format("[(0)] Like '%(1)%'", kvp.Key, kvp.Value);
                else
                    filter += string.Format("And [(0)] Like '%(1)%'", kvp.Key, kvp.Value);
            }

            return filter;

        }

    }
}
